#pragma once

#include <stdint.h>
//#ifdef REIGN_DESKTOP
//#include <d3d11.h>
//#else
#include <d3d11_1.h>
//#endif

/// Constants

#define Undefined_Slot										(-1)
#define SEHNSUCHT_VERTEX_BUFFER_NUM_SLOTS					D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT // 32
#define SEHNSUCHT_CBUFFER_NUM_SLOTS							D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT // 14
#define SEHNSUCHT_SAMPLER_NUM_SLOTS							D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT // 16
#define SEHNSUCHT_SRV_NUM_SLOTS								D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT // 128
#define SEHNSUCHT_UAV_NUM_SLOTS								D3D11_PS_CS_UAV_REGISTER_COUNT // 8
#define SEHNSUCHT_VIEWPORT_NUM_SLOTS						D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE // 16
#define SEHNSUCHT_SCISSOR_RECT_NUM_SLOTS					D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE // 16
#define SEHNSUCHT_RTV_NUM_SLOTS								D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT // 8
#define SEHNSUCHT_DESIGN_SCALE_DPI_PIXELS					(96.0F)
#define SEHNSUCHT_DEFAULT_DXGI_FORMAT						(DXGI_FORMAT::DXGI_FORMAT_B8G8R8A8_UNORM) // Most common dxgi format for swapchains
#define SEHNSUCHT_DEFAULT32_INDEX_BUFFER_DXGI_FORMAT		(DXGI_FORMAT::DXGI_FORMAT_R32_UINT) // Most common dxgi format for index buffers (uint32)
#define SEHNSUCHT_DEFAULT16_INDEX_BUFFER_DXGI_FORMAT		(DXGI_FORMAT::DXGI_FORMAT_R16_UINT) // Most common dxgi format for index buffers (uint16)
#define SEHNSUCHT_OM_DEFAULT_SAMPLE_MASK					(0XFFFFFFFFU)

// Shortcuts

#define InfiniteLoop										for ( ; ; ) // Good luck!
#define Is_Undefined_Slot( Id )								( Id == Undefined_Slot )
#define CreateAsync											Concurrency::create_task // Creates generic async action/operation
#define Is_Valid_VertexBuffer_Slot( iSlot )					( ((uint32_t)iSlot) < SEHNSUCHT_VERTEX_BUFFER_NUM_SLOTS )
#define Is_Valid_ConstantBuffer_Slot( iSlot )				( ((uint32_t)iSlot) < SEHNSUCHT_CBUFFER_NUM_SLOTS )
#define Is_Valid_Sampler_Slot( iSlot )						( ((uint32_t)iSlot) < SEHNSUCHT_SAMPLER_NUM_SLOTS )
#define Is_Valid_SRV_Slot( iSlot )							( ((uint32_t)iSlot) < SEHNSUCHT_SRV_NUM_SLOTS )
#define Is_Valid_UAV_Slot( iSlot )							( ((uint32_t)iSlot) < SEHNSUCHT_UAV_NUM_SLOTS )
#define Is_Valid_Viewport_Slot( iSlot )						( ((uint32_t)iSlot) < SEHNSUCHT_VIEWPORT_NUM_SLOTS )
#define Is_Valid_ScissorRect_Slot( iSlot )					( ((uint32_t)iSlot) < SEHNSUCHT_SCISSOR_RECT_NUM_SLOTS )
#define Is_Valid_RenderTarget_Slot( iSlot )					( ((uint32_t)iSlot) < SEHNSUCHT_RTV_NUM_SLOTS )
#define Foreach_VertexBuffer_Slot( iSlot )					for ( int32_t iSlot = 0; iSlot < SEHNSUCHT_VERTEX_BUFFER_NUM_SLOTS; iSlot++ )
#define Foreach_ConstantBuffer_Slot( iSlot )				for ( int32_t iSlot = 0; iSlot < SEHNSUCHT_CBUFFER_NUM_SLOTS; iSlot++ )
#define Foreach_Sampler_Slot( iSlot )						for ( int32_t iSlot = 0; iSlot < SEHNSUCHT_SAMPLER_NUM_SLOTS; iSlot++ )
#define Foreach_SRC_Slot( iSlot )							for ( int32_t iSlot = 0; iSlot < SEHNSUCHT_SRV_NUM_SLOTS; iSlot++ )
#define Foreach_UAV_Slot( iSlot )							for ( int32_t iSlot = 0; iSlot < SEHNSUCHT_UAV_NUM_SLOTS; iSlot++ )
#define Foreach_Viewport_Slot( iSlot )						for ( int32_t iSlot = 0; iSlot < SEHNSUCHT_VIEWPORT_NUM_SLOTS; iSlot++ )
#define Foreach_ScissorRect_Slot( iSlot )					for ( int32_t iSlot = 0; iSlot < SEHNSUCHT_SCISSOR_RECT_NUM_SLOTS; iSlot++ )
#define Foreach_RenderTarget_Slot( iSlot )					for ( int32_t iSlot = 0; iSlot < SEHNSUCHT_RTV_NUM_SLOTS; iSlot++ )
#define Foreach_VertexBuffer_Slot_Reversed( iSlot )			for ( int32_t iSlot = SEHNSUCHT_VERTEX_BUFFER_NUM_SLOTS - 1; iSlot >= 0; iSlot-- )
#define Foreach_ConstantBuffer_Slot_Reversed( iSlot )		for ( int32_t iSlot = SEHNSUCHT_CBUFFER_NUM_SLOTS - 1; iSlot >= 0; iSlot-- )
#define Foreach_Sampler_Slot_Reversed( iSlot )				for ( int32_t iSlot = SEHNSUCHT_SAMPLER_NUM_SLOTS - 1; iSlot >= 0; iSlot-- )
#define Foreach_SRV_Slot_Reversed( iSlot )					for ( int32_t iSlot = SEHNSUCHT_SRV_NUM_SLOTS - 1; iSlot >= 0; iSlot-- )
#define Foreach_UAV_Slot_Reversed( iSlot )					for ( int32_t iSlot = SEHNSUCHT_UAV_NUM_SLOTS - 1; iSlot >= 0; iSlot-- )



